package com.jd.risk.bankorder.util;

import com.jd.payment.utils.common.JsonUtil;

public class Result<T> {

	public Result(){}
	
	public Result(boolean isSuccess,String code,String message){
		this.result = isSuccess;
		this.resultCode = code;
		this.resultMessage = message;
	}
	
	private boolean result;
	
	private String resultCode;
	
	private String resultMessage;
	
	private T resultObj;
	
	public void update(boolean isSuccess,String code,String message){
		this.result = isSuccess;
		this.resultCode = code;
		this.resultMessage = message;
	}
	
	public String toString(){
		String resultObjStr = this.resultObj==null ? "": JsonUtil.toJson(this.resultObj);
		return new String("result:"+this.isSuccess()+" code:"+this.resultCode+" message:"+this.resultMessage+" resultObj:"+resultObjStr);
	}
	
	public boolean isSuccess(){
		return this.result;
	}

	public boolean getResult() {
		return result;
	}

	public void setResult(boolean result) {
		this.result = result;
	}

	public String getResultCode() {
		return resultCode;
	}

	public void setResultCode(String resultCode) {
		this.resultCode = resultCode;
	}

	public String getResultMessage() {
		return resultMessage;
	}

	public void setResultMessage(String resultMessage) {
		this.resultMessage = resultMessage;
	}

	public T getResultObj() {
		return resultObj;
	}

	public void setResultObj(T resultObj) {
		this.resultObj = resultObj;
	}
	
}
